Book Contents

Memory considerations

High memory consumption will degrade application performance.

To achieve best performance, understand each trend object's memory consumption potential:

  • Trending memory is consumed over time and not allocated on startup of the application.
  • Buffer extra trend data for real time trending only. Avoid buffering if the application uses data logging. The data log will act as the buffer.
  • The trend must be linked to the data log model on the Pens tab of the Trend Object Properties dialog box for historical trending.
  • Avoid leaving the trend shown for long periods of time. Depending on the X-Axis time scale, the trend may consume more memory than is available.
  • The trend object runs within the 32 Mb Windows CE process limit. Additional RAM will not help after the 32 Mb limit is reached.
  • Set the buffer for extra data well below the theoretical maximum buffer size of 32,767 records. If the trend pens are configured with the maximum buffer size of 32,767 records, the entire allocated program memory on the terminal are consumed in a matter of a few hours, resulting in the out of memory error.
  • Plotting a single data point requires 58 bytes of memory. Buffering too much extra data or setting the X-Axis time span too high (hours, days) will consume excessive memory. To calculate memory usage for a trend object, refer to the following table.

    Single trend object

    Runtime memory consumption (formulas)

    Example (four Pens, X- Axis of 15 hours, one second Refresh Rate, buffer size 10,000)

    Real-time trending

    # of pens * 58 bytes * Trend Refresh Rate (entries per second) * X-axis (seconds)

    4 pens * 58 bytes * 1 entries/second * 15 hours * 3600 seconds = ~12.5 Mb Used

    Additional trend buffered data

    58 bytes * # of pens * buffer size

    58 bytes * 4 pens * 10,000 = ~2.3 Mb

    Total memory consumption

    (# of pens * 58 bytes * Trend Refresh Rate (entries per second) * X – axis (seconds)) + (58 bytes * # of pens * buffer size)

    12.5 Mb + 2.3 Mb = ~14.3 Mb Used

See also

Options on the Pens tab of the Trend Object Properties dialog box

Trend Refresh Rate

Keywords: best practice, trend